use jar_poolt in java_class_loadert
This commit is contained in:
parent
d601a44114
commit
384f0d44da
|
@ -252,7 +252,7 @@ java_class_loadert::jar_index_optcreft java_class_loadert::read_jar_file(
|
|||
std::vector<std::string> filenames;
|
||||
try
|
||||
{
|
||||
filenames = this->jar_pool(jar_path).filenames();
|
||||
filenames = jar_pool(jar_path).filenames();
|
||||
}
|
||||
catch(const std::runtime_error &)
|
||||
{
|
||||
|
@ -325,33 +325,3 @@ std::string java_class_loadert::class_name_to_file(const irep_idt &class_name)
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
jar_filet &java_class_loadert::jar_pool(
|
||||
const std::string &file_name)
|
||||
{
|
||||
const auto it=m_archives.find(file_name);
|
||||
if(it==m_archives.end())
|
||||
{
|
||||
// VS: Can't construct in place
|
||||
auto file = jar_filet(file_name);
|
||||
return m_archives.emplace(file_name, std::move(file)).first->second;
|
||||
}
|
||||
else
|
||||
return it->second;
|
||||
}
|
||||
|
||||
jar_filet &java_class_loadert::jar_pool(
|
||||
const std::string &buffer_name,
|
||||
const void *pmem,
|
||||
size_t size)
|
||||
{
|
||||
const auto it=m_archives.find(buffer_name);
|
||||
if(it==m_archives.end())
|
||||
{
|
||||
// VS: Can't construct in place
|
||||
auto file = jar_filet(pmem, size);
|
||||
return m_archives.emplace(buffer_name, std::move(file)).first->second;
|
||||
}
|
||||
else
|
||||
return it->second;
|
||||
}
|
||||
|
|
|
@ -17,9 +17,10 @@ Author: Daniel Kroening, kroening@kroening.com
|
|||
#include <util/message.h>
|
||||
#include <util/fixed_keys_map_wrapper.h>
|
||||
|
||||
#include "jar_file.h"
|
||||
#include "jar_pool.h"
|
||||
#include "java_bytecode_parse_tree.h"
|
||||
#include "java_class_loader_limit.h"
|
||||
#include "jar_file.h"
|
||||
|
||||
class java_class_loadert:public messaget
|
||||
{
|
||||
|
@ -99,20 +100,8 @@ public:
|
|||
return class_map.at(class_name).front();
|
||||
}
|
||||
|
||||
/// Load jar archive or retrieve from cache if already loaded
|
||||
/// \param filename name of the file
|
||||
jar_filet &jar_pool(const std::string &filename);
|
||||
|
||||
/// Load jar archive or retrieve from cache if already loaded
|
||||
/// \param buffer_name name of the original file
|
||||
/// \param pmem memory pointer to the contents of the file
|
||||
/// \param size size of the memory buffer
|
||||
/// Note that this mocks the existence of a file which may
|
||||
/// or may not exist since the actual data bis retrieved from memory.
|
||||
jar_filet &jar_pool(
|
||||
const std::string &buffer_name,
|
||||
const void *pmem,
|
||||
size_t size);
|
||||
/// a cache for jar_filet, by path name
|
||||
jar_poolt jar_pool;
|
||||
|
||||
private:
|
||||
/// Either a regular expression matching files that will be allowed to be
|
||||
|
@ -134,8 +123,6 @@ private:
|
|||
/// The jar_indext for each jar file we've read
|
||||
std::map<std::string, jar_indext> jars_by_path;
|
||||
|
||||
/// Jar files that have been loaded
|
||||
std::map<std::string, jar_filet> m_archives;
|
||||
/// Map from class names to the bytecode parse trees
|
||||
parse_tree_with_overridest_mapt class_map;
|
||||
|
||||
|
|
Loading…
Reference in New Issue